home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / uudbz002.zip / dbzMake.Cmd < prev    next >
OS/2 REXX Batch file  |  1997-07-27  |  2KB  |  82 lines

  1. /* Rexx */
  2. /* dbzMake.Cmd -- Make sure you are in the correct directory, */
  3. /* then make sure that library and include paths are setup. */
  4. /*If not, then call dbz_mksetup.cmd.  Finally, run dmake. */
  5.  
  6. rc = SysFileTree('.\lib', 'libDir', 'OD')
  7. if rc \= 0 then
  8.     signal NoMemory
  9. if libDir.0 \= 1 then
  10.     signal WrongDirectory
  11.  
  12. rc = SysFileTree('.\news', 'newsDir', 'OD')
  13. if rc \= 0 then
  14.     signal NoMemory
  15. if newsDir.0 \= 1 then
  16.     signal WrongDirectory
  17.  
  18. needSetup = 0
  19. libPath = value('LIBRARY_PATH',, 'OS2ENVIRONMENT')
  20. incPath = value('C_INCLUDE_PATH',, 'OS2ENVIRONMENT')
  21. libDir.1 = Translate(libDir.1, '/', '\')
  22. newsDir.1 = Translate(newsDir.1, '/', '\')
  23.  
  24. rc = Pos(libDir.1, libPath)
  25. if rc = 0 then
  26.     needSetup = 1
  27.  
  28. rc = Pos(libDir.1, incPath)
  29. if rc = 0 then
  30.     needSetup = 1
  31.  
  32. rc = Pos(newsDir.1, libPath)
  33. if rc = 0 then
  34.     needSetup = 1
  35.  
  36. rc = Pos(newsDir.1, incPath)
  37. if rc = 0 then
  38.     needSetup = 1
  39.  
  40. if needSetup = 1 then
  41. do
  42.     /* Make sure there is a semi-colon on the end first. */
  43.     /* Do not assume that merely because one of the variables */
  44.     /* does not end with a semi-colon, that the other does not */
  45.     /* as well. */
  46.     lastSemi = LastPos(';', libPath)
  47.     strLength = Length(libPath)
  48.     if lastSemi < strLength then
  49.     do
  50.         libPath = libPath||';'
  51.         libPath = value('LIBRARY_PATH',libPath, 'OS2ENVIRONMENT')
  52.     end
  53.  
  54.     lastSemi = LastPos(';', incPath)
  55.     strLength = Length(incPath)
  56.     if lastSemi < strLength then
  57.     do
  58.         incPath = incPath||';'
  59.         incPath = value('C_INCLUDE_PATH',incPath, 'OS2ENVIRONMENT')
  60.     end
  61.  
  62.     /* Add semi-colon to the end to make this easier */
  63.     call dbz_mksetup libDir.1||';'||newsDir.1||';'
  64.  
  65. end /* if needSetup = 1 */
  66.  
  67. 'dmake -f Makefile.dbz'
  68. /* Return whatever dmake returns */
  69. exit rc
  70. /* End of main program */
  71.  
  72. NoMemory:
  73. say "SysFileTree() error, not enough memory?"
  74. exit 1
  75.  
  76. WrongDirectory:
  77. say "Cannot find specified directory."
  78. say "Be sure to run this from the same directory"
  79. say "that the makefile is in."
  80. exit 2
  81.  
  82.